import { request } from '@/request'
import { AddSetmealData, SetmealItem, SetmealParams, SetmealResult } from '@/types/setmeal'

export function getSetmealListApi(params: SetmealParams) {
  return request<SetmealResult>(
    '/admin/setmeal/page', "get", params
  )
}

export function updateStatusApi(id: number, status: number,) {
  return request(
    `/admin/setmeal/status/${status}`, "post", { id }, true
  )
}

export function addSetmealApi(data: AddSetmealData) {
  return request(
    '/admin/setmeal', "post", data
  )
}

export function getSetmealDetailApi(id: number) {
  return request<SetmealItem>(
    `/admin/setmeal/${id}`, "get"
  )
}

export function updateSetmealApi(data: AddSetmealData) {
  return request(
    '/admin/setmeal', "put", data
  )
}

export function deleteSetmealApi(ids: string) {
  return request(
    '/admin/setmeal', "delete", { ids }
  )
}